#!/usr/bin/env python
from global_parameter import *
from path_integral_2d_kmax1 import *
from log import *
from post_process import *


if __name__ == "__main__":
	if kmax == 1:
		run_round = 1
		statics = None
		while run_round < iteration + 1:
			init = system_initial_state(init_state)
			results = tensor_calculate_for_kmax1(system_parameters, init, temperature, Spectral_Density, step, env_parameters, cal_range, recal_w0, pulse_signal, pulse_time, delta0_extra, epsi_extra)		
			if static_function == 1:
				if run_round == 1:
					statics = matrix(results[1:][:])
				else:
					statics = static_sum(results, statics)
			if config_name != "None":
				log_dir = create_dir(config_name, run_round)
			else:
				log_dir = create_dir(config_name)	
			write_log(log_dir, results)
			write_info(log_dir, post_process(results))	
			run_round += 1
		if static_function == 1:
			statics = static_average(statics, iteration)
			write_statics(config_name, statics.tolist())
